import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;


public class Friend2Reduce extends Reducer<Text,FriendValue,Text, Text> {
    /*
    map发过来的格式是这样的
       友人1  友人2  共同好友
       A  B,YES
    * A 	C, B
      B	    D, C
      C	    A, B
      D	    B, C
    * */
    @Override
    protected void reduce(Text key, Iterable<FriendValue> values, Context context) throws IOException, InterruptedException {
        for (FriendValue value : values){
            context.write(key,new Text(value.getFa()+" 共同好友："+value.getFb()));
        }
    }

}

